home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
DATAEND.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
1KB
|
44 lines
' DATAEND.BAS
' This program reads information into three arrays and prints it.
' The maximum number of names that can be entered is 50; fewer
' can be entered by typing "END" for the salesperson name.
OPTION BASE 1 ' set base of all arrays to 1
DIM salesGroup$(50) ' dimension salesGroup$ string array
DIM bikesSold%(50) ' dimension bikesSold% integer array
DIM totalSales!(50) ' dimension totalSales! floating-point array
CLS
PRINT "Follow prompts to enter bike shop data. Type END to quit."
PRINT
count% = 1 ' initialize an array counter variable
WHILE (salesGroup$(count%) <> "END") ' continue until name = "END"
INPUT "Enter salesperson name: ", salesGroup$(count%)
IF (salesGroup$(count%) <> "END") THEN
INPUT " Bikes sold: ", bikesSold%(count%)
INPUT " Total sales: $", totalSales!(count%)
PRINT
count% = count% + 1 ' increment the array counter
END IF
WEND
PRINT
PRINT "You entered the following sales data:"
PRINT
PRINT "Salesperson Bikes sold Total sales"
PRINT "------------------------------------------"
PRINT
' initialize tmp$, a formatting template for PRINT USING
tmp$ = "\ \ ### $$####.##"
FOR i% = 1 TO count% - 1 ' print contents of each array
PRINT USING tmp$; salesGroup$(i%); bikesSold%(i%); totalSales!(i%)
NEXT i%